package homework_07.homework_Car;

import jdk.swing.interop.SwingInterOpUtils;

import java.util.Scanner;

public class Rent {
    public static void main(String[] args) {
        Automoblie automoblie=null;
        Scanner input = new Scanner(System.in);
        AutomoblieRent automoblieRent=new AutomoblieRent();
        automoblieRent.carInIt();
        System.out.println("欢迎光临");
        System.out.println("请输入您要租赁的汽车:");
        System.out.println("1.轿车\t 2.客车");
        String brand ="";
        String type ="";
        String seatCount ="";
        int flag =  input.nextInt();
        if (flag ==1){
            System.out.println("请选择您想要的轿车品牌:");
            System.out.println("1.宝马\t 2.别克");
            int flag2=input.nextInt();
            if(flag2==1){
                brand="宝马";
                System.out.println("请选择您想要的汽车型号：");
                System.out.println("1.x6\t 2.x5");
                int flag3 = input.nextInt();
                if (flag3==1){
                    type="x6";
                     automoblie=automoblieRent.zuChe("宝马","x6","");
                }else {
                    type="x5";
                    automoblie=automoblieRent.zuChe("宝马","x5","");
                }
            }else if (flag ==2){
                 brand="别克";
                System.out.println("请选择您想要的汽车型号：");
                System.out.println("1.GL8\t 2.君威");
                int flag3 = input.nextInt();
                if (flag3==1){
                    automoblie=automoblieRent.zuChe("别克","GL8","");
                }else {
                    automoblie=automoblieRent.zuChe("别克","君威","");
                }
            }
        }else if (flag == 2){
            type="";
            System.out.println("请选择您要租赁的客车座位数：");
            System.out.println("1.15坐以下\t 2.15坐以上");
            int flag2=input.nextInt();
            if(flag2==1){
                System.out.println("请输入您想要的汽车品牌：");
                System.out.println("1.金龙\t 2.金杯");
                int flag3=input.nextInt();
                if (flag3==1){
                    seatCount ="15坐以下";
                    automoblie=automoblieRent.zuChe("金龙","","15坐以下");
                }else {
                    seatCount ="15坐以下";
                    automoblie=automoblieRent.zuChe("金杯","","15坐以下");
                }
            }else if(flag2 ==2){
                System.out.println("请输入您想要的汽车品牌：");
                System.out.println("1.金龙\t 2.金杯");
                int flag3=input.nextInt();
                if (flag3==1){
                    seatCount ="15坐以上";
                    automoblie=automoblieRent.zuChe("金龙","","15坐以上");
                }else {
                    seatCount ="15坐以上";
                    automoblie=automoblieRent.zuChe("金杯","","15坐以上");
                }
            }
        }
        if (automoblie!=null){
            System.out.println("请输入租车的天数：");
            int days =input.nextInt();
            int money =automoblie.rent(days);
            if(automoblie instanceof Car){
                System.out.println("您租赁的汽车品牌是："+automoblie.getBrand()+",型号是"+type);
            }else if(automoblie instanceof  Bus){
                System.out.println("您租赁的汽车品牌是："+automoblie.getBrand()+",座位数是"+seatCount);
            }
            System.out.println("您需要支付的费用是："+money+"元");
        }else{
            System.out.println("请重新选择！");
        }

    }
}
